﻿using Payroll.Biz.Legacy.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;

namespace Payroll.Biz.Legacy.Models
{
    public class MonthlySchedule : IPaymentSchedule
    {
        public DateTime GetPayPeriodStartDate(DateTime date)
        {
            return new DateTime(date.Year, date.Month, 1, 0, 0, 0, date.Kind);
        }

        public bool IsPayDate(DateTime payDate)
        {
            return DateUtils.IsLastDayOfMonth(payDate);
        }

        public override string ToString()
        {
            return $"{{Monthly payment schedule}}";
        }

        public override bool Equals(object obj)
        {
            return obj is MonthlySchedule;
        }

        public override int GetHashCode()
        {
            return RuntimeHelpers.GetHashCode(this);
        }
    }
}
